/*
 * Created on Wed Jun 06 2018 by Ronnie Ren (zhaosong.ren) from Accenture
 *
 * Copyright (c) 2018 DingXing information & technology limited company.
 */

import { Injectable } from "@angular/core";
import { SqliteService } from "../../services/sqliteDB/sqlite.service";
import { SysUserDto } from "../dto/sysUser.dto";
import { Observable } from "rxjs";


@Injectable()
export class SysUserService {

  constructor(private sqliteService: SqliteService) {

  }


  fetchAllUserIds(): Observable<Array<string>> {
    return Observable.fromPromise(this.sqliteService.simpleFetch(SysUserDto, ["id"]))
      .map((rows: { results: Array<{ id: string }> }) => {
        return Array.from(rows.results).map((item) => item.id);
      });
  }



}
